import { all, fork } from 'redux-saga/effects';
const context = import.meta.glob<{ default: string }>('./*.ts', { eager: true })
let keys = Object.keys(context)
const sagas: any[] = []
keys.map((filename) => {
  if (filename !== './index.ts') {
    sagas.push(context[filename].default)
  }
})

const sagasForks = sagas.map(saga => fork(saga));

export default function* rootSaga() {
  yield all(sagasForks);
}